package org.kailu.book.entity;
// default package
// Generated May 24, 2014 1:38:24 PM by Hibernate Tools 4.0.0

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Proxy;

/**
 * Category generated by hbm2java
 */
@Entity
@Proxy(lazy=false)
@Table(name = "category", catalog = "book")
public class CategoryEntity implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer categoryId;
	private String categoryName;
	private Set<BookEntity> books = new HashSet<BookEntity>(0);

	public CategoryEntity() {
	}

	public CategoryEntity(String categoryName) {
		this.categoryName = categoryName;
	}

	public CategoryEntity(String categoryName, Set<BookEntity> books) {
		this.categoryName = categoryName;
		this.books = books;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "category_id", unique = true, nullable = false)
	public Integer getCategoryId() {
		return this.categoryId;
	}

	public void setCategoryId(Integer categoryId) {
		this.categoryId = categoryId;
	}

	@Column(name = "category_name", nullable = false, length = 50)
	public String getCategoryName() {
		return this.categoryName;
	}

	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "category")
	public Set<BookEntity> getBooks() {
		return this.books;
	}

	public void setBooks(Set<BookEntity> books) {
		this.books = books;
	}

}
